local skel = fk.CreateSkill {
  name = "emo__fuyuan",
}

Fk:loadTranslationTable{
  ["emo__fuyuan"] = "福愿",
  [":emo__fuyuan"] = "每当你受到伤害后，你可以摸一张牌并展示所有手牌，若其中有【闪】，你可以移动场上一张牌，若无，你令来源弃置两张牌。",

  ["#emo__fuyuan-move"] = "福愿：你可以移动场上一张牌",
}

skel:addEffect(fk.Damaged, {
  anim_type = "masochism",
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, skel.name)
    if player.dead or player:isKongcheng() then return end
    local cards = player:getCardIds("h")
    player:showCards(cards)
    if player.dead then return end
    if table.find(cards, function(id) return Fk:getCardById(id).trueName == "jink" end) then
      local targets = room:askToChooseToMoveCardInBoard(player, {prompt = "#emo__fuyuan-move", skill_name = skel.name, cancelable = true })
      if #targets > 1 then
        room:askToMoveCardInBoard(player, { skill_name = skel.name, target_one = targets[1], target_two = targets[2] })
      end
    else
      if data.from and not data.from.dead and not data.from:isNude() then
        room:askToDiscard(data.from, { min_num =2, max_num = 2, include_equip = true, skill_name = skel.name, cancelable = false})
      end
    end
  end,
})

return skel
